Micron Document
welo git mirrors

Node / public / rns-proxy / commits / 46bf5b4

Commit 46bf5b4e95f42d9a3b4ae4d51719d02d51c1787d


Parents : e0f6f22
Author : welo | main nixos computer <empty@empty.com>
Date : 2026-09-09T20:27:28+01:00

updated rns dependencies temp

Changes

4 files changed, 120 insertions(+), 46 deletions(-)

M Cargo.lock +83 -9
M Cargo.toml +3 -3
M src/cli.rs +14 -17
M src/mux.rs +20 -17

Diff

diff --git a/Cargo.lock b/Cargo.lock
index fe5591e..dc9ad2b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -423,7 +423,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.52.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -453,12 +453,82 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
+[[package]]
+name = "futures"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
[[package]]
name = "futures-core"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
+[[package]]
+name = "futures-executor"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
+
+[[package]]
+name = "futures-util"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "memchr",
+ "pin-project-lite",
+ "slab",
+]
+
[[package]]
name = "heck"
version = "0.5.0"
@@ -783,8 +853,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "rns-core"
version = "0.1.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4da568d23a40b8a59a25ffa080e9fdef5d381143eb8b219dd1beb0e57bf20848"
+source = "git+https://github.com/lelloman/rns-rs.git?rev=refs%2Fpull%2F153%2Fhead#13aa84428cab754542ac316e228fe97ec3b36bdf"
dependencies = [
"libm",
"log",
@@ -794,8 +863,7 @@ dependencies = [
[[package]]
name = "rns-crypto"
version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b7e1dea60e8fb459df3d7f0a018c62f868480d4159ba48d28d6f4c37a0a1200"
+source = "git+https://github.com/lelloman/rns-rs.git?rev=refs%2Fpull%2F153%2Fhead#13aa84428cab754542ac316e228fe97ec3b36bdf"
dependencies = [
"aes",
"cbc",
@@ -807,11 +875,11 @@ dependencies = [
[[package]]
name = "rns-net"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "778e2c18995bfcfd4fbc5a04db074a33746759358d2e757dabaf1768d1c06313"
+version = "0.7.2"
+source = "git+https://github.com/lelloman/rns-rs.git?rev=refs%2Fpull%2F153%2Fhead#13aa84428cab754542ac316e228fe97ec3b36bdf"
dependencies = [
"bzip2",
+ "futures",
"libc",
"log",
"polling",
@@ -857,7 +925,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.52.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -925,6 +993,12 @@ version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5"
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
[[package]]
name = "smallvec"
version = "1.15.2"

diff --git a/Cargo.toml b/Cargo.toml
index d219b4c..0d34ace 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ fast-socks5 = "1.0"
hex = "0.4"
udp-stream = "0.0.12"
-rns-net = "0.7.1"
-rns-core = "0.1.17"
-rns-crypto = "0.1.10"
+rns-net = { git = "https://github.com/lelloman/rns-rs.git" , rev = "refs/pull/153/head"}
+rns-core = { git = "https://github.com/lelloman/rns-rs.git" , rev = "refs/pull/153/head"}
+rns-crypto = { git = "https://github.com/lelloman/rns-rs.git" , rev = "refs/pull/153/head"}
prse = "1.2.1"

diff --git a/src/cli.rs b/src/cli.rs
index b47cbcf..4804a14 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,6 +1,6 @@
use clap::{Parser, Subcommand};
+// use Commands::
use prse::try_parse;
-
#[derive(Parser)]
#[command(name = "rns-proxy")]
#[command(about = "SOCKS5 proxy over Reticulum Network Stack")]
@@ -30,7 +30,6 @@ pub enum Commands {
/// prevents a client from connecting to private addresses.
#[clap(long, short, action)]
private_network_block: bool,
-
},
/// Run the SOCKS5 proxy client (local proxy)
@@ -44,25 +43,25 @@ pub enum Commands {
listen: String,
},
/// Connects to localhost ports of the server (Port forwarding)
- Connect {
+ Connect {
/// RNS destination hash (hex)
#[arg(short, long)]
destination: String,
/// connects udp ports, can be specified as just the port number or as SERVER_PORT:CLIENT_PORT. Multiple of this flag can be specified
#[arg(short, long, value_parser = port_parser)]
- udp_port: Vec<(u16,u16)>,
+ udp_port: Vec<(u16, u16)>,
/// connectcs tcp ports, can be specified as just the port number or as SERVER_PORT:CLIENT_PORT. Multiple of this flag can be specified
#[arg(short, long, value_parser = port_parser)]
- tcp_port: Vec<(u16,u16)>,
+ tcp_port: Vec<(u16, u16)>,
/// shorthand for connecting to both udp and tcp, can be specified as just the port number or as SERVER_PORT:CLIENT_PORT. Multiple of this flag can be specified
#[arg(short, long, value_parser = port_parser)]
- both_port: Vec<(u16,u16)>, // both udp and tcp
+ both_port: Vec<(u16, u16)>, // both udp and tcp
},
/// Exposes a SOCKS5 proxy that only allows clients to connect to specified localhost ports.
- Forward {
+ Forward {
#[arg(long, value_name = "PATH")]
/// Path to the identity file for persistent server address.
/// Defaults to ~/.reticulum/rns_proxy_identity
@@ -77,20 +76,18 @@ pub enum Commands {
tcp_port: Vec<u16>,
#[arg(short, long)]
- /// allow connecting to localhost tcp and udp port for any client accessing this destination. Multiple of this flag can be specified
- both_port: Vec<u16>, }
+ /// allow connecting to localhost tcp and udp port for any client accessing this destination. Multiple of this flag can be specified
+ both_port: Vec<u16>,
+ },
}
-
-
-fn port_parser(s: &str) -> Result<(u16,u16),String> {
- if let Ok((server_port,client_port)) = try_parse!(s,"{}:{}") {
- return Ok((server_port,client_port));
+fn port_parser(s: &str) -> Result<(u16, u16), String> {
+ if let Ok((server_port, client_port)) = try_parse!(s, "{}:{}") {
+ return Ok((server_port, client_port));
}
- if let Ok(port) = try_parse!(s,"{}") {
- return Ok((port,port));
+ if let Ok(port) = try_parse!(s, "{}") {
+ return Ok((port, port));
}
-
return Err("Invalid port input".into());
}

diff --git a/src/mux.rs b/src/mux.rs
index 386adf0..1dbc23f 100644
--- a/src/mux.rs
+++ b/src/mux.rs
@@ -16,14 +16,14 @@
use std::collections::HashMap;
use std::sync::Arc;
-use tokio::sync::{Mutex};
+use tokio::sync::Mutex;
use log::{error, info, warn};
use rns_core::constants::LINK_MDU;
-use rns_net::{LinkId, RnsNode};
-use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender, unbounded_channel};
+use rns_net::{LinkId, RnsNode};
+use tokio::sync::mpsc::{self, unbounded_channel, UnboundedReceiver, UnboundedSender};
-use crate::frame::FrameDecodeState::{DecodingFailed, MoreDataRequired};
+use crate::frame::FrameDecodeState::{DecodingFailed, MoreDataRequired};
use crate::{Frame, FrameType};
/// Context byte for our link data. We use CONTEXT_NONE (0x00) which routes
@@ -48,8 +48,12 @@ struct MuxInner {
}
// allows for sending things faster cause it's on a different thread and makes sure everything ends up in order.
-pub fn run_link_sender(node: Arc<RnsNode>, link_id: Arc<Mutex<Option<LinkId>>>) -> UnboundedSender<Vec<u8>> {
- let (sender,mut receiver): (UnboundedSender<Vec<u8>>, UnboundedReceiver<Vec<u8>>) = unbounded_channel();
+pub fn run_link_sender(
+ node: Arc<RnsNode>,
+ link_id: Arc<Mutex<Option<LinkId>>>,
+) -> UnboundedSender<Vec<u8>> {
+ let (sender, mut receiver): (UnboundedSender<Vec<u8>>, UnboundedReceiver<Vec<u8>>) =
+ unbounded_channel();
tokio::spawn(async move {
while let Some(data_frame) = receiver.recv().await {
@@ -62,22 +66,21 @@ pub fn run_link_sender(node: Arc<RnsNode>, link_id: Arc<Mutex<Option<LinkId>>>)
};
for chunk in data_frame.chunks(LINK_MDU) {
- if let Err(e) = node.send_on_link(active_link.0, chunk.to_vec(), DATA_CONTEXT) {
+ if let Err(e) = node
+ .send_on_link(active_link.0, chunk.to_vec(), DATA_CONTEXT)
+ .await
+ {
warn!("Failed to send link data: {:?}", e);
*link_id.lock().await = None;
break;
}
}
-
}
});
-
return sender;
}
-
-
impl MuxHandle {
/// Create a new multiplexer handle.
pub fn new(node: Arc<RnsNode>) -> Self {
@@ -89,7 +92,7 @@ impl MuxHandle {
sessions: Mutex::new(HashMap::new()),
next_sid: Mutex::new(0),
recv_buf: Mutex::new(Vec::new()),
- data_sender_buf: Arc::new(run_link_sender(node.clone(), link_id))
+ data_sender_buf: Arc::new(run_link_sender(node.clone(), link_id)),
}),
}
}
@@ -147,15 +150,15 @@ impl MuxHandle {
/// multiple different sids from sending at the same time and scrambling packets
pub async fn send_frame(&self, frame: &Frame) {
let encoded = frame.encode();
- _=self.inner.data_sender_buf.send(encoded);
+ _ = self.inner.data_sender_buf.send(encoded);
// pretty much should never error so we don't care.
-
}
/// Convenience: send a typed frame.
pub async fn send(&self, frame_type: FrameType, session_id: u32, payload: Vec<u8>) {
// info!("send frame");
- self.send_frame(&Frame::new(frame_type, session_id, payload)).await;
+ self.send_frame(&Frame::new(frame_type, session_id, payload))
+ .await;
}
/// Dispatch an incoming frame to the appropriate session.
@@ -203,7 +206,7 @@ impl MuxHandle {
MoreDataRequired => {
// info!("more data required");
break;
- // just wait for next packet
+ // just wait for next packet
}
DecodingFailed => {
// A damaged or out-of-sync frame must not crash the
@@ -219,7 +222,7 @@ impl MuxHandle {
break;
}
}
- },
+ }
}
}

Served by rngit 1.5.1 - Generated in 0.09s